<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>我的简历</title>
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/bootstrap-icons/1.8.0/font/bootstrap-icons.min.css">
    <style>
        :root {
            --primary-color: #3370ff;
            --background-color: #f5f7fa;
            --card-bg-color: #ffffff;
            --border-color: #e0e0e0;
            --text-primary: #303133;
            --text-secondary: #606266;
            --text-light: #909399;
            --success-color: #67c23a;
            --warning-color: #ff9900;
            --border-radius: 8px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, Simsun, sans-serif;
            background-color: var(--background-color);
            color: var(--text-primary);
            line-height: 1.5;
            font-size: 14px;
            max-width: 375px;
            margin: 0 auto;
            min-height: 100vh;
            height: 100%;
            position: relative;
        }

        .app-container {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            background-color: var(--background-color);
        }

        /* Header */
        .page-header {
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: var(--card-bg-color);
            position: relative;
            box-shadow: 0 1px 2px rgba(0,0,0,0.05);
            z-index: 10;
        }

        .page-title {
            font-size: 17px;
            font-weight: 600;
            color: var(--text-primary);
        }

        .back-button {
            position: absolute;
            left: 15px;
            font-size: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .btn-icon {
            border: none;
            background: none;
            color: var(--text-primary);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 36px;
            height: 36px;
            border-radius: 50%;
        }

        .btn-icon:active {
            background-color: rgba(0,0,0,0.05);
        }

        /* Stats Section */
        .stats-section {
            margin: 16px;
            background-color: var(--card-bg-color);
            border-radius: var(--border-radius);
            overflow: hidden;
            padding: 16px;
        }

        .stats-title {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 12px;
            display: flex;
            align-items: center;
        }

        .stats-title i {
            margin-right: 8px;
            color: var(--primary-color);
        }

        .stats-content {
            display: flex;
            justify-content: space-between;
        }

        .stat-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 8px 0;
            flex: 1;
        }

        .stat-value {
            font-size: 20px;
            font-weight: bold;
            color: var(--primary-color);
            margin-bottom: 4px;
        }

        .stat-label {
            font-size: 12px;
            color: var(--text-secondary);
        }

        /* Resume List */
        .resume-section {
            margin: 16px;
            background-color: var(--card-bg-color);
            border-radius: var(--border-radius);
            overflow: hidden;
            padding: 16px;
            margin-bottom: 80px; /* 底部留出空间 */
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        }

        .section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .section-title {
            font-size: 16px;
            font-weight: 600;
            display: flex;
            align-items: center;
        }

        .section-title i {
            margin-right: 8px;
            color: var(--primary-color);
        }

        .create-resume-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: var(--primary-color);
            color: white;
            border: none;
            font-size: 14px;
            padding: 8px 16px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 2px 6px rgba(51, 112, 255, 0.3);
        }

        .create-resume-btn:hover {
            background-color: #2860f0;
            box-shadow: 0 4px 8px rgba(51, 112, 255, 0.4);
        }

        .create-resume-btn:active {
            opacity: 0.9;
            transform: scale(0.97);
        }

        .create-resume-btn i {
            margin-right: 6px;
            font-size: 15px;
        }

        .resume-list {
            width: 100%;
        }

        .resume-item {
            border-bottom: 1px solid var(--border-color);
            padding: 16px 0;
            display: flex;
            position: relative;
            transition: all 0.3s ease;
            cursor: pointer;
            animation: slide-in-right 0.3s ease forwards;
            animation-delay: calc(var(--index) * 0.1s);
            opacity: 0;
        }

        .resume-item:hover {
            transform: translateX(5px);
            background-color: rgba(51, 112, 255, 0.02);
        }

        .resume-item:last-child {
            border-bottom: none;
        }

        .resume-preview {
            width: 64px;
            height: 84px;
            background-color: #f0f7ff;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--primary-color);
            font-size: 28px;
            margin-right: 16px;
            overflow: hidden;
            border: 1px solid rgba(51, 112, 255, 0.2);
            box-shadow: 0 2px 6px rgba(51, 112, 255, 0.1);
            transition: all 0.3s ease;
            position: relative;
        }

        .resume-preview::before {
            content: 'PDF';
            position: absolute;
            bottom: 5px;
            font-size: 10px;
            font-weight: bold;
            color: #ff4d4f;
        }

        .resume-item:hover .resume-preview {
            box-shadow: 0 4px 12px rgba(51, 112, 255, 0.2);
            transform: translateY(-2px);
        }

        .resume-preview img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .resume-info {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .resume-title {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 6px;
            color: var(--text-primary);
            transition: color 0.3s ease;
        }

        .resume-item:hover .resume-title {
            color: var(--primary-color);
        }

        .resume-updated {
            font-size: 12px;
            color: var(--text-light);
            margin-bottom: 8px;
            display: flex;
            align-items: center;
        }
        
        .resume-updated i {
            margin-right: 4px;
            font-size: 12px;
        }

        .resume-tags {
            display: flex;
            flex-wrap: wrap;
        }

        .resume-tag {
            background-color: #f0f0f0;
            color: var(--text-secondary);
            font-size: 12px;
            padding: 3px 8px;
            border-radius: 4px;
            margin-right: 6px;
            margin-bottom: 4px;
            transition: all 0.3s ease;
        }

        .resume-item:hover .resume-tag {
            background-color: #e9e9e9;
        }

        .default-tag {
            background-color: #e6f7ff;
            color: var(--primary-color);
            border: 1px solid rgba(51, 112, 255, 0.2);
        }

        .resume-item:hover .default-tag {
            background-color: #d9efff;
        }

        .resume-status {
            position: absolute;
            top: 16px;
            right: 36px;
            font-size: 12px;
            color: var(--success-color);
            display: flex;
            align-items: center;
        }

        .resume-status i {
            margin-right: 4px;
        }

        .warning {
            color: var(--warning-color);
        }

        .resume-menu {
            position: absolute;
            top: 16px;
            right: 6px;
            width: 28px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            border-radius: 50%;
            transition: all 0.2s ease;
        }

        .resume-menu:hover {
            background-color: rgba(0,0,0,0.05);
        }

        .resume-menu:active {
            background-color: rgba(0,0,0,0.1);
            transform: scale(0.95);
        }

        /* Bottom Navigation */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 50px;
            background-color: var(--card-bg-color);
            display: flex;
            box-shadow: 0 -1px 2px rgba(0,0,0,0.1);
            z-index: 10;
            max-width: 375px;
            margin: 0 auto;
        }

        .nav-item {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: var(--text-light);
            font-size: 11px;
            cursor: pointer;
        }

        .nav-item i {
            font-size: 20px;
            margin-bottom: 2px;
        }

        .nav-item.active {
            color: var(--primary-color);
        }

        /* 上下文菜单 */
        #overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0,0,0,0.3);
            z-index: 100;
            display: none;
        }

        #context-menu {
            position: absolute;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 4px 16px rgba(0,0,0,0.15);
            width: 140px;
            z-index: 101;
            overflow: hidden;
            display: none;
            animation: menu-fade 0.2s ease;
        }

        @keyframes menu-fade {
            from { opacity: 0; transform: scale(0.9); }
            to { opacity: 1; transform: scale(1); }
        }

        .menu-option {
            padding: 12px 16px;
            display: flex;
            align-items: center;
            cursor: pointer;
            transition: all 0.2s ease;
            color: var(--text-primary);
        }

        .menu-option:hover {
            background-color: #f5f7fa;
            color: var(--primary-color);
        }

        .menu-option:active {
            background-color: #eef2f7;
        }

        .menu-option i {
            margin-right: 10px;
            width: 16px;
            text-align: center;
            font-size: 15px;
        }

        .menu-option[data-action="delete"] {
            color: #ff4d4f;
        }

        .menu-option[data-action="delete"]:hover {
            background-color: #fff1f0;
        }

        /* 加载动画 */
        .loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(255,255,255,0.8);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }

        .loading-spinner {
            width: 40px;
            height: 40px;
            border: 3px solid rgba(0,0,0,0.1);
            border-radius: 50%;
            border-top-color: var(--primary-color);
            animation: spinner 0.8s linear infinite;
            margin-bottom: 8px;
        }

        .loading-text {
            color: var(--text-secondary);
            font-size: 14px;
        }

        @keyframes spinner {
            to {
                transform: rotate(360deg);
            }
        }

        /* Toast 消息 */
        .toast-message {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background-color: rgba(0,0,0,0.7);
            color: white;
            padding: 10px 16px;
            border-radius: 4px;
            font-size: 14px;
            max-width: 80%;
            text-align: center;
            z-index: 1001;
            animation: fade-in-out 2.5s forwards;
        }

        @keyframes fade-in-out {
            0%, 100% { opacity: 0; }
            10%, 90% { opacity: 1; }
        }

        /* 添加滑动动画效果 */
        @keyframes slide-in-right {
            from { transform: translateX(30px); opacity: 0; }
            to { transform: translateX(0); opacity: 1; }
        }

        @keyframes slide-in-up {
            from { transform: translateY(20px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }

        /* 空状态样式 */
        .empty-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 40px 20px;
            text-align: center;
            animation: slide-in-up 0.5s ease;
        }

        .empty-state-icon {
            font-size: 60px;
            color: #e0e0e0;
            margin-bottom: 16px;
        }

        .empty-state-text {
            font-size: 16px;
            color: var(--text-secondary);
            margin-bottom: 24px;
        }

        .empty-state-btn {
            background-color: var(--primary-color);
            color: white;
            border: none;
            font-size: 14px;
            padding: 10px 20px;
            border-radius: 6px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            box-shadow: 0 2px 6px rgba(51, 112, 255, 0.3);
        }

        .empty-state-btn:hover {
            background-color: #2860f0;
            box-shadow: 0 4px 8px rgba(51, 112, 255, 0.4);
        }

        .empty-state-btn i {
            margin-right: 6px;
        }

        /* 添加淡入淡出动画类 */
        .fade-in {
            animation: fadeIn 0.3s ease forwards;
        }
        .fade-out {
            animation: fadeOut 0.3s ease forwards;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-5px); }
            to { opacity: 1; transform: translateY(0); }
        }
        @keyframes fadeOut {
            from { opacity: 1; transform: translateY(0); }
            to { opacity: 0; transform: translateY(5px); }
        }

        /* 添加上下文菜单样式 */
        .context-menu {
            position: absolute;
            background: white;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            border-radius: 8px;
            z-index: 1000;
            overflow: hidden;
            animation: fadeIn 0.2s ease;
            min-width: 160px;
        }
        
        .menu-item {
            padding: 12px 16px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
        }
        
        .menu-item i {
            margin-right: 10px;
            font-size: 14px;
            width: 18px;
            text-align: center;
        }
        
        .menu-item:hover {
            background-color: #f0f7ff;
        }
        
        .menu-item[data-action="delete"]:hover {
            color: #ff4d4f;
            background-color: #fff1f0;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(5px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .resume-item.removing {
            animation: fadeOut 0.3s ease forwards;
        }
        
        @keyframes fadeOut {
            from { opacity: 1; transform: translateX(0); }
            to { opacity: 0; transform: translateX(-20px); }
        }

        /* 动画样式 */
        .animate-in {
            opacity: 0;
            transform: translateY(10px);
            transition: opacity 0.3s ease, transform 0.3s ease;
        }
        
        .animate-in.visible {
            opacity: 1;
            transform: translateY(0);
        }
        
        /* 重新加载动画 */
        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }
        
        .upload-success {
            animation: pulse 0.5s ease;
        }

        /* 简历操作按钮样式 */
        .resume-actions {
            display: flex;
            align-items: center;
            margin-left: auto;
        }

        .action-btn {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            border: none;
            background: #f5f7fa;
            color: var(--text-secondary);
            margin-left: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }

        .action-btn:hover {
            background: var(--primary-color);
            color: white;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(51, 112, 255, 0.3);
        }

        .action-btn:active {
            transform: translateY(0);
            box-shadow: 0 2px 4px rgba(51, 112, 255, 0.2);
        }

        .download-btn:hover {
            background: #4caf50;
        }

        .more-btn:hover {
            background: #ff9800;
        }

        /* 修改resume-meta样式 */
        .resume-meta {
            display: flex;
            flex-direction: column;
            margin-bottom: 5px;
        }

        .resume-date {
            font-size: 12px;
            color: var(--text-light);
            margin-bottom: 6px;
            display: flex;
            align-items: center;
        }
        
        .resume-date i {
            margin-right: 4px;
            font-size: 12px;
        }
    </style>
</head>
<body>
    <div class="app-container">
        <header class="page-header">
            <button class="btn-icon back-button" onclick="history.back()">
                <i class="bi bi-chevron-left"></i>
            </button>
            <h1 class="page-title">我的简历</h1>
        </header>

        <div class="stats-section">
            <div class="stats-title">
                <i class="bi bi-pie-chart-fill"></i>
                简历概况
            </div>
            <div class="stats-content">
                <div class="stat-item">
                    <div class="stat-value">3</div>
                    <div class="stat-label">简历总数</div>
                </div>
                <div class="stat-item">
                    <div class="stat-value">2</div>
                    <div class="stat-label">录用简历</div>
                </div>
                <div class="stat-item">
                    <div class="stat-value">10</div>
                    <div class="stat-label">被浏览次数</div>
                </div>
            </div>
        </div>

        <div class="resume-section">
            <div class="section-header">
                <div class="section-title">
                    <i class="bi bi-file-earmark-text-fill"></i>
                    简历列表
                </div>
                <button class="create-resume-btn" id="create-resume">
                    <i class="bi bi-upload"></i>
                    上传简历
                </button>
                <input type="file" id="resume-upload" accept=".pdf" style="display: none;">
            </div>
            <div class="resume-list" id="resume-list">
                <!-- 空状态 -->
                <div class="empty-state" id="empty-state" style="display: none;">
                    <div class="empty-state-icon">
                        <i class="bi bi-file-earmark-pdf"></i>
                    </div>
                    <div class="empty-state-text">你还没有上传任何简历</div>
                    <button class="empty-state-btn">
                        <i class="bi bi-upload"></i>
                        上传PDF简历
                    </button>
                    <input type="file" id="empty-state-upload" accept=".pdf" style="display: none;">
                </div>
                
                <div class="resume-item" data-resume-id="1" style="--index: 0;">
                    <div class="resume-preview">
                        <i class="bi bi-file-earmark-pdf-fill"></i>
                    </div>
                    <div class="resume-info">
                        <div class="resume-title">校招求职简历</div>
                        <div class="resume-updated">
                            <i class="bi bi-clock"></i>
                            最近更新: 2023-07-15
                        </div>
                        <div class="resume-tags">
                            <span class="resume-tag default-tag">默认</span>
                            <span class="resume-tag">校招</span>
                            <span class="resume-tag">前端开发</span>
                        </div>
                    </div>
                    <div class="resume-status">
                        <i class="bi bi-check-circle-fill"></i>
                        已完善
                    </div>
                    <div class="resume-menu">
                        <i class="bi bi-three-dots-vertical"></i>
                    </div>
                </div>

                <div class="resume-item" data-resume-id="2" style="--index: 1;">
                    <div class="resume-preview">
                        <i class="bi bi-file-earmark-pdf-fill"></i>
                    </div>
                    <div class="resume-info">
                        <div class="resume-title">实习简历</div>
                        <div class="resume-updated">
                            <i class="bi bi-clock"></i>
                            最近更新: 2023-06-20
                        </div>
                        <div class="resume-tags">
                            <span class="resume-tag">实习</span>
                            <span class="resume-tag">后端开发</span>
                        </div>
                    </div>
                    <div class="resume-status">
                        <i class="bi bi-check-circle-fill"></i>
                        已完善
                    </div>
                    <div class="resume-menu">
                        <i class="bi bi-three-dots-vertical"></i>
                    </div>
                </div>

                <div class="resume-item" data-resume-id="3" style="--index: 2;">
                    <div class="resume-preview">
                        <i class="bi bi-file-earmark-pdf-fill"></i>
                    </div>
                    <div class="resume-info">
                        <div class="resume-title">产品经理简历</div>
                        <div class="resume-updated">
                            <i class="bi bi-clock"></i>
                            最近更新: 2023-05-05
                        </div>
                        <div class="resume-tags">
                            <span class="resume-tag">产品</span>
                        </div>
                    </div>
                    <div class="resume-status warning">
                        <i class="bi bi-exclamation-triangle-fill"></i>
                        待完善
                    </div>
                    <div class="resume-menu">
                        <i class="bi bi-three-dots-vertical"></i>
                    </div>
                </div>
            </div>
        </div>

        <footer class="bottom-nav">
            <div class="nav-item">
                <i class="bi bi-house-door-fill"></i>
                <span>首页</span>
            </div>
            <div class="nav-item">
                <i class="bi bi-briefcase-fill"></i>
                <span>实习</span>
            </div>
            <div class="nav-item">
                <i class="bi bi-compass-fill"></i>
                <span>发现</span>
            </div>
            <div class="nav-item active">
                <i class="bi bi-person-fill"></i>
                <span>我的</span>
            </div>
        </footer>
    </div>

    <!-- 右键菜单 -->
    <div id="overlay"></div>
    <div id="context-menu">
        <div class="menu-option" data-action="view">
            <i class="bi bi-eye-fill"></i>
            <span>查看</span>
        </div>
        <div class="menu-option" data-action="edit">
            <i class="bi bi-pencil-fill"></i>
            <span>编辑</span>
        </div>
        <div class="menu-option" data-action="setDefault">
            <i class="bi bi-star-fill"></i>
            <span>设为默认</span>
        </div>
        <div class="menu-option" data-action="download">
            <i class="bi bi-download"></i>
            <span>下载</span>
        </div>
        <div class="menu-option" data-action="delete">
            <i class="bi bi-trash-fill"></i>
            <span>删除</span>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 获取DOM元素
            const resumeItems = document.querySelectorAll('.resume-item');
            const resumeMenus = document.querySelectorAll('.resume-menu');
            const contextMenu = document.getElementById('context-menu');
            const overlay = document.getElementById('overlay');
            const menuOptions = document.querySelectorAll('.menu-option');
            const createResumeBtn = document.getElementById('create-resume');
            const emptyState = document.getElementById('empty-state');
            const resumeList = document.getElementById('resume-list');
            
            // 当前选中的简历ID
            let selectedResumeId = null;
            
            // 检查是否有简历，如果没有则显示空状态
            function checkEmptyState() {
                const hasResumes = document.querySelectorAll('.resume-item').length > 0;
                
                if (!hasResumes) {
                    emptyState.style.display = 'flex';
                } else {
                    emptyState.style.display = 'none';
                }
            }
            
            // 初始检查空状态
            checkEmptyState();
            
            // 空状态按钮点击事件
            const emptyStateBtn = document.querySelector('.empty-state-btn');
            if (emptyStateBtn) {
                emptyStateBtn.addEventListener('click', function() {
                    // 触发空状态上传窗口
                    document.getElementById('empty-state-upload').click();
                });
            }
            
            // 空状态上传处理
            document.getElementById('empty-state-upload').addEventListener('change', function(e) {
                if (this.files && this.files[0]) {
                    const file = this.files[0];
                    
                    // 检查文件类型
                    if (file.type !== 'application/pdf') {
                        showToast('请上传PDF格式的简历文件');
                        return;
                    }
                    
                    // 检查文件大小 (5MB限制)
                    if (file.size > 5 * 1024 * 1024) {
                        showToast('文件大小不能超过5MB');
                        return;
                    }
                    
                    showLoading('正在上传简历...');
                    
                    // 模拟上传过程
                    setTimeout(() => {
                        hideLoading();
                        
                        // 生成随机ID (实际应该由后端生成)
                        const newResumeId = Date.now().toString();
                        
                        // 添加新的简历项到列表
                        addResumeItem({
                            id: newResumeId,
                            title: file.name.replace('.pdf', ''),
                            updateTime: formatDate(new Date()),
                            tags: ['已上传'],
                            status: 'success'
                        });
                        
                        // 更新统计数据
                        updateResumeCount();
                        
                        showToast('简历上传成功');
                    }, 1500);
                }
            });
            
            // 为每个简历项添加点击事件（查看简历详情）
            resumeItems.forEach(item => {
                item.addEventListener('click', function(e) {
                    // 如果点击的不是菜单按钮，则跳转到详情页
                    if (!e.target.closest('.resume-menu')) {
                        const resumeId = this.getAttribute('data-resume-id');
                        
                        // 添加点击动画效果
                        this.style.transition = 'transform 0.2s ease, opacity 0.2s ease';
                        this.style.transform = 'scale(0.98)';
                        this.style.opacity = '0.8';
                        
                        // 延迟跳转，让动画效果可见
                        setTimeout(() => {
                            // 跳转到简历详情页
                            window.location.href = `resume-detail.html?id=${resumeId}`;
                        }, 200);
                    }
                });
            });
            
            // 为菜单按钮添加点击事件
            resumeMenus.forEach(menu => {
                menu.addEventListener('click', function(e) {
                    e.stopPropagation(); // 阻止冒泡，防止触发简历项的点击事件
                    
                    // 获取当前简历项
                    const resumeItem = this.closest('.resume-item');
                    selectedResumeId = resumeItem.getAttribute('data-resume-id');
                    
                    // 添加动画效果
                    this.classList.add('active');
                    
                    // 获取当前按钮的位置
                    const rect = this.getBoundingClientRect();
                    
                    // 显示菜单
                    showContextMenu(rect.left - 120, rect.bottom + 5);
                });
            });
            
            // 为创建简历按钮添加点击事件
            createResumeBtn.addEventListener('click', function() {
                // 添加点击动画效果
                this.classList.add('active');
                
                // 触发文件上传窗口
                document.getElementById('resume-upload').click();
            });
            
            // 处理文件上传
            document.getElementById('resume-upload').addEventListener('change', function(e) {
                if (this.files && this.files[0]) {
                    const file = this.files[0];
                    
                    // 检查文件类型
                    if (file.type !== 'application/pdf') {
                        showToast('请上传PDF格式的简历文件');
                        return;
                    }
                    
                    // 检查文件大小 (5MB限制)
                    if (file.size > 5 * 1024 * 1024) {
                        showToast('文件大小不能超过5MB');
                        return;
                    }
                    
                    showLoading('正在上传简历...');
                    
                    // 模拟上传过程
                    setTimeout(() => {
                        hideLoading();
                        
                        // 生成随机ID (实际应该由后端生成)
                        const newResumeId = Date.now().toString();
                        
                        // 添加新的简历项到列表
                        addResumeItem({
                            id: newResumeId,
                            title: file.name.replace('.pdf', ''),
                            updateTime: formatDate(new Date()),
                            tags: ['已上传'],
                            status: 'success'
                        });
                        
                        // 更新统计数据
                        updateResumeCount();
                        
                        showToast('简历上传成功');
                    }, 1500);
                }
            });
            
            // 格式化日期
            function formatDate(date) {
                const year = date.getFullYear();
                const month = String(date.getMonth() + 1).padStart(2, '0');
                const day = String(date.getDate()).padStart(2, '0');
                return `${year}-${month}-${day}`;
            }
            
            // 更新简历计数
            function updateResumeCount() {
                const resumeItems = document.querySelectorAll('.resume-item');
                const totalCount = resumeItems.length;
                
                // 更新总数
                const totalElement = document.querySelector('.stat-value[data-type="total"]');
                if (totalElement) {
                    totalElement.textContent = totalCount;
                }
                
                // 检查是否有空状态
                checkEmptyState();
            }
            
            // 添加简历项到列表
            function addResumeItem(resume) {
                const resumeList = document.querySelector('.resume-list');
                
                // 创建新的简历项
                const resumeItem = document.createElement('div');
                resumeItem.className = 'resume-item animate-in';
                resumeItem.setAttribute('data-id', resume.id);
                
                // 设置HTML内容
                resumeItem.innerHTML = `
                    <div class="resume-preview">
                        <i class="bi bi-file-earmark-pdf-fill"></i>
                    </div>
                    <div class="resume-info">
                        <div class="resume-title">${resume.title}</div>
                        <div class="resume-meta">
                            <span class="resume-date">
                                <i class="bi bi-clock"></i>
                                上传时间: ${resume.updateTime}
                            </span>
                            <div class="resume-tags">
                                ${resume.tags.map(tag => `<span class="resume-tag">${tag}</span>`).join('')}
                            </div>
                        </div>
                    </div>
                    <div class="resume-actions">
                        <button class="action-btn download-btn">
                            <i class="bi bi-download"></i>
                        </button>
                        <button class="action-btn more-btn">
                            <i class="bi bi-three-dots-vertical"></i>
                        </button>
                    </div>
                `;
                
                // 将新简历项添加到列表开头
                resumeList.insertBefore(resumeItem, resumeList.firstChild);
                
                // 为新添加的简历项添加事件
                addResumeItemEvents(resumeItem);
                
                // 隐藏空状态
                checkEmptyState();
                
                // 动画效果
                setTimeout(() => {
                    resumeItem.classList.add('visible');
                }, 50);
            }
            
            // 为新添加的简历项添加事件
            function addResumeItemEvents(resumeItem) {
                // 下载按钮点击事件
                const downloadBtn = resumeItem.querySelector('.download-btn');
                if (downloadBtn) {
                    downloadBtn.addEventListener('click', function(e) {
                        e.stopPropagation();
                        // 获取简历ID
                        const resumeId = resumeItem.getAttribute('data-id');
                        // 获取简历标题
                        const resumeTitle = resumeItem.querySelector('.resume-title').textContent;
                        // 模拟下载
                        simulateDownload(resumeId, resumeTitle);
                    });
                }
                
                // 更多按钮点击事件
                const moreBtn = resumeItem.querySelector('.more-btn');
                if (moreBtn) {
                    moreBtn.addEventListener('click', function(e) {
                        e.stopPropagation();
                        // 显示操作菜单
                        showContextMenu(resumeItem, e);
                    });
                }
                
                // 简历项点击事件 - 查看简历
                resumeItem.addEventListener('click', function() {
                    const resumeId = resumeItem.getAttribute('data-id');
                    showToast('正在打开简历...');
                    
                    // 模拟打开简历
                    setTimeout(() => {
                        window.location.href = `resume-detail.html?id=${resumeId}`;
                    }, 500);
                });
            }
            
            // 模拟下载PDF文件
            function simulateDownload(resumeId, resumeTitle) {
                showLoading('准备下载简历...');
                
                // 模拟下载延迟
                setTimeout(() => {
                    hideLoading();
                    showToast('简历已开始下载');
                    
                    // 创建一个临时链接来模拟下载
                    const a = document.createElement('a');
                    a.href = '#'; // 实际应用中这里应该是文件的URL
                    a.download = `${resumeTitle}.pdf`;
                    document.body.appendChild(a);
                    a.click();
                    document.body.removeChild(a);
                }, 1000);
            }
            
            // 显示上下文菜单
            function showContextMenu(resumeItem, event) {
                // 移除现有的上下文菜单
                const existingMenu = document.querySelector('.context-menu');
                if (existingMenu) {
                    document.body.removeChild(existingMenu);
                }
                
                // 创建新的上下文菜单
                const contextMenu = document.createElement('div');
                contextMenu.className = 'context-menu';
                
                // 设置菜单项
                contextMenu.innerHTML = `
                    <div class="menu-item" data-action="share">
                        <i class="bi bi-share"></i> 分享简历
                    </div>
                    <div class="menu-item" data-action="rename">
                        <i class="bi bi-pencil"></i> 重命名
                    </div>
                    <div class="menu-item" data-action="delete">
                        <i class="bi bi-trash"></i> 删除简历
                    </div>
                `;
                
                // 定位菜单位置
                const rect = resumeItem.getBoundingClientRect();
                contextMenu.style.top = `${rect.bottom + window.scrollY}px`;
                contextMenu.style.left = `${rect.left + window.scrollX}px`;
                
                // 添加到页面
                document.body.appendChild(contextMenu);
                
                // 添加菜单项点击事件
                contextMenu.querySelectorAll('.menu-item').forEach(item => {
                    item.addEventListener('click', function() {
                        const action = this.getAttribute('data-action');
                        const resumeId = resumeItem.getAttribute('data-id');
                        
                        // 处理不同的操作
                        handleMenuAction(action, resumeId, resumeItem);
                        
                        // 关闭菜单
                        document.body.removeChild(contextMenu);
                    });
                });
                
                // 点击其他区域关闭菜单
                document.addEventListener('click', function closeMenu(e) {
                    if (!contextMenu.contains(e.target) && e.target !== resumeItem.querySelector('.more-btn')) {
                        if (document.body.contains(contextMenu)) {
                            document.body.removeChild(contextMenu);
                        }
                        document.removeEventListener('click', closeMenu);
                    }
                });
            }
            
            // 处理菜单操作
            function handleMenuAction(action, resumeId, resumeItem) {
                switch (action) {
                    case 'share':
                        // 显示分享对话框
                        showToast('分享功能即将上线');
                        break;
                    case 'rename':
                        // 弹出重命名对话框
                        const newName = prompt('请输入新的简历名称', resumeItem.querySelector('.resume-title').textContent);
                        if (newName && newName.trim() !== '') {
                            // 更新简历名称
                            resumeItem.querySelector('.resume-title').textContent = newName.trim();
                            showToast('简历已重命名');
                        }
                        break;
                    case 'delete':
                        // 确认删除
                        if (confirm('确定要删除这份简历吗？此操作不可撤销。')) {
                            // 添加删除动画
                            resumeItem.classList.add('removing');
                            
                            // 延迟删除元素
                            setTimeout(() => {
                                resumeItem.remove();
                                // 更新计数
                                updateResumeCount();
                                showToast('简历已删除');
                            }, 300);
                        }
                        break;
                }
            }
            
            // 显示加载状态
            function showLoading(message = '处理中...') {
                // 移除已有的loading
                hideLoading();
                
                // 创建新的loading
                const loadingEl = document.createElement('div');
                loadingEl.className = 'loading-overlay';
                loadingEl.innerHTML = `<div class="loading-spinner"></div><div class="loading-text">${message}</div>`;
                document.body.appendChild(loadingEl);
            }
            
            // 隐藏加载状态
            function hideLoading() {
                const loadingEl = document.querySelector('.loading-overlay');
                if (loadingEl) {
                    document.body.removeChild(loadingEl);
                }
            }
            
            // 显示提示消息
            function showToast(message) {
                // 移除可能存在的toast
                const existingToast = document.querySelector('.toast-message');
                if (existingToast) {
                    document.body.removeChild(existingToast);
                }
                
                // 创建新toast
                const toast = document.createElement('div');
                toast.className = 'toast-message';
                toast.textContent = message;
                document.body.appendChild(toast);
                
                // 2.5秒后自动移除（动画本身是2.5秒）
                setTimeout(() => {
                    if (document.body.contains(toast)) {
                        document.body.removeChild(toast);
                    }
                }, 2500);
            }

            // 初始化函数
            function init() {
                // 初次检查空状态
                checkEmptyState();
                
                // 添加示例简历数据
                if (!document.querySelector('.resume-item')) {
                    // 延迟添加示例数据 - 模拟加载
                    setTimeout(() => {
                        // 示例数据
                        const sampleResumes = [
                            {
                                id: 'sample1',
                                title: '软件工程师简历',
                                updateTime: '2023-10-15',
                                tags: ['已上传'],
                                status: 'success'
                            },
                            {
                                id: 'sample2',
                                title: '产品经理求职简历',
                                updateTime: '2023-09-28',
                                tags: ['已上传'],
                                status: 'success'
                            }
                        ];
                        
                        // 添加示例数据
                        sampleResumes.forEach((resume, index) => {
                            setTimeout(() => {
                                addResumeItem(resume);
                            }, index * 300);
                        });
                        
                        // 更新统计数据
                        setTimeout(() => {
                            updateResumeCount();
                        }, sampleResumes.length * 300);
                    }, 500);
                }
            }
            
            // 页面加载后初始化
            document.addEventListener('DOMContentLoaded', init);
        });
    </script>
</body>
</html> 